<extend name="Layout/ins_page" />
<block name="content">
    <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
    <div  id='fm1'>
       <fieldset id="fd1" style="border: 1px solid #e5e5e5;height: 50px">
        <legend><span></span></legend>
        <div id="fm1">
        <div class="fieldset-body" style="margin:0px 5px;">
                 
 <!--          买家姓名： <input id="U_Cstname"  name="U_Cstname" class="mini-textbox" enabled='false' />
          手机号码： <input  id="U_Phone"  name="U_Phone" class="mini-textbox"  value=""enabled='false' /><br/><br/> -->
         <!--订单号： <input type="text" id="orderSn"  name="orderSn" class="mini-textbox" autocomplete="off" placeholder="" />
         手机号：<input type="text" class="mini-textbox" autocomplete="off" placeholder="" id="phone" name="phone">-->  
        反馈日期：
		<input id="startTime" class="mini-datepicker" value="{$startTime}" format='yyyy-MM-dd' valueType='string' style='width:8.5%;margin-left:-4px'/>
		<input id="endTime" class="mini-datepicker" value="{$endTime}" format='yyyy-MM-dd' valueType='string' style='width:8.5%' />
        反馈状态：
		<label class="checkbox-inline"><input value="25" type="checkbox" checked="checked" name="statuslist">已发货</label>
		<label class="checkbox-inline"><input value="30" type="checkbox" checked="checked" name="statuslist">无人签收退货</label>
        <label class="checkbox-inline"><input value="40" type="checkbox" checked="checked" name="statuslist">已签收</label>
        <label class="checkbox-inline"><input value="65" type="checkbox" checked="checked" name="statuslist">退货失败</label>
		<label class="checkbox-inline"><input value="70" type="checkbox" checked="checked" name="statuslist">已退回</label>	
         结算状态： <select name='is_balance' id="is_balance"  >
                    <option value=''>请选择</option>
                    <option value=0>未结算</option>
                    <option value=1>已结算</option>
                    <option value=2>已收款</option>
                </select>
          <a class="mini-button" onClick="search()" style="margin-left:20px;"><span class="mini-button-text ">&nbsp;&nbsp;查询&nbsp;&nbsp;</span></a>
          <a  style="float:right;" class="mini-button" onClick="exportData()"><span class="mini-button-text ">&nbsp;&nbsp;导出&nbsp;&nbsp;</span></a>  
          
        </div>
        
        
        
          </div>
    </fieldset>
     
        <div class="fieldset-body">

            <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;margin-top: 5px;overflow:auto;" plain="false"
                 buttons="#tabsButtons"
            >
                <div title="列表：" >

                    <div id="datagrid1" class="mini-datagrid" style="height:430px;width: 100%;"
                         url="index.php?m=&c=Boc365&a=getPushList" idField="id"
                         allowResize="true"
                         allowCellEdit="true" allowCellSelect="true" multiSelect="true"
                         allowCellValid="true" oncellvalidation=""
                    >

                        <div property="columns">

                           
                             <div field="order_code"  headerAlign="center"  >订单号
                                <input property="" class="mini-textbox" style="width:100%;" />
                            </div>
                            
                            <div field="status"  headerAlign="center"  >最终状态
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 
                            <div field="p_time"  headerAlign="center"  >反馈时间
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 
                            
                             <div field="is_balance"  headerAlign="center"  >结算状态
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 
                            
                            <div field="batch_no"  headerAlign="center"  >反馈批次
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div>

                        </div>
                    </div>
                </div>
                <!-- <div title="Tab2" iconCls="" >
                    2
                </div> -->
            </div>
        </div>
    </div>


    </body>
    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        grid.setPageSize(50);
        grid.load();
        grid.on("drawcell", function (e) {
            var record = e.record,
                column = e.column,
                field = e.field,
                value = e.value;
			if (field == "status") {
				if(value==20)
				{
                  e.cellHtml ='已接收';
				}else if(value==25){
				  e.cellHtml ='已发货';
				}else if(value==30){
				  e.cellHtml ='无人签收退货';
				}else if(value==40){
				  e.cellHtml ='已签收';
				}else if(value==50){
				  e.cellHtml ='订单下达退货';
				}else if(value==60){
				  e.cellHtml ='退货处理中';
				}else if(value==65){
				  e.cellHtml ='退货失败';
				}else if(value==70){
				  e.cellHtml ='已退货';
				}
            }
			
			if (field=="is_balance") {
				if(value==1)
				{
                  e.cellHtml ='已结算';
				}else if(value==2){
				  e.cellHtml ='已收款';
				}else{
				  e.cellHtml ='未结算';
				}
		     }

        });
		
		
         function search(){
			 
			 
		
			var startTime = mini.get('startTime').getValue();
			var endTime = mini.get('endTime').getValue();
			//var statuslist=mini.get('statuslist').getValue();
			//alert(statuslist);
			var status = [];
			$("input[name='statuslist']:checked").each(function(){ //遍历table里的全部checkbox
				//idsstr += $(this).val() + ","; //获取所有checkbox的值
				//如果被选中
				     status.push($(this).val());//将选中的值添加到数组chk_value中
					//isc += $(this).val() + ","; //获取被选中的值
					//alert($(this).val());
			
			});
			 var  myselect=document.getElementById("is_balance");
                          var index=myselect.selectedIndex ;             // selectedIndex代表的是你所选中项的index
						  var is_balance=myselect.options[index].value;
	       grid.load({startTime: startTime,endTime:endTime,status:status.toString(),is_balance:is_balance})     
      	
        }
		
         

        function approve(list_tag,approve) {

            //确认提示
            mini.confirm("确定？", "确定？",
                function (action) {
                    if (action == "ok") {

                        $.ajax({
                            url: "/SapSupplier/doupdatesapitemfromexcel",
                            type: "post",
                            data: {list_tag: list_tag, approve: approve},
                            dataType: 'json',
                            success: function (data) {
                                mini.alert(data.msg);
                            }
                        });


                    } else {

                    }
                }
            );

        }

      function exportData()
	  {
			var startTime = mini.get('startTime').getValue();
			var endTime = mini.get('endTime').getValue();
			var status = [];
			$("input[name='statuslist']:checked").each(function(){ //遍历table里的全部checkbox
				     status.push($(this).val());//将选中的值添加到数组chk_value中
			});
			var  myselect=document.getElementById("is_balance");
                          var index=myselect.selectedIndex ;             // selectedIndex代表的是你所选中项的index
						  var is_balance=myselect.options[index].value;
	        var url="index.php?m=&c=Boc365&a=export&startTime="+startTime+"&endTime="+endTime+"&status="+status.toString()+"&is_balance="+is_balance;
	        location.href=url;
	  }


    </script>
</block>

